<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>怡臣 | 终极平台管理</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/Public/admin/adminlte/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/font-awesome/font-awesome.min.css">
    <!-- Ionicons -->
    <!--link rel="stylesheet" href="/Public/admin/adminlte/plugins/ionicons/ionicons.min.css"-->
    <!-- Theme style -->
    <link rel="stylesheet" href="/Public/admin/adminlte/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="/Public/admin/adminlte/dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/iCheck/flat/blue.css">
    <!-- Morris chart -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/morris/morris.css">
    <!-- jvectormap -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/daterangepicker/daterangepicker.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="/Public/admin/adminlte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <link rel="stylesheet" href="/Public/admin/css/common.css">
	<script src="/Public/admin/adminlte/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="/Public/admin/js/jquery.validate.min.js"></script>
    <script src="/Public/admin/js/jquery.validate.config.js"></script>
    <script src="/Public/admin/js/common.js?v=20170331001"></script>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="/Public/admin/adminlte/plugins/html5shiv/html5shiv.min.js"></script>
    <script src="/Public/admin/adminlte/plugins/html5shiv/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <header class="main-header">
        <!-- Logo -->
        <a href="" class="logo">
            <span class="logo-mini"><b>怡臣</b></span>
            <span class="logo-lg"><b>怡臣终极平台</b>管理</span>
        </a>
        <nav class="navbar navbar-static-top">
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                <span class="sr-only">Toggle navigation</span>
            </a>
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="/Public/admin/adminlte/dist/img/pingtai-face.png" class="user-image" alt="User Image">
                            <span class="hidden-xs"><?php echo session('manageInfo')['login_name'];?></span>
                        </a>
                    </li>
                    <li class="dropdown notifications-menu">
                        <a href="/Manage/login/loginOut" class="dropdown-toggle">
                            <i class="fa fa-bell-o">退出</i>
                            <span class="label label-warning">~</span>
                        </a>
                    </li>
                </ul>
            </div>
        </nav>
    </header>

<!-- Left logo -->
<?php
if (session('manageInfo')['account_id'] == 1) { ?>
<aside class="main-sidebar">
    <section class="sidebar">
        <!-- 导航页面 -->
        <ul class="sidebar-menu">
            <li class="treeview <?php if(CONTROLLER_NAME == index): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-dashboard"></i> <span>首页管理</span>
                    <span class="pull-right-container">
                      <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="active"><a href="<?php echo U('manage/index/index');?>"><i class="fa fa-circle-o"></i> 首页</a></li>
                </ul>
            </li>
            <li class="<?php echo CONTROLLER_NAME == 'Weixin' ? 'active' : ''; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i>
                    <span>微信设置</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == twoDBarcode): ?>active<?php endif; ?>"><a href="<?php echo U('Weixin/twoDBarcode');?>"><i class="fa fa-circle-o"></i> 二维码列表</a></li>
                </ul>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == wxInformation): ?>active<?php endif; ?>">
                        <a href="<?php echo U('Weixin/wxInformation');?>"><i class="fa fa-circle-o"></i> 微信消息模板列表</a>
                    </li>
                </ul>
            </li>
            <li class="<?php echo CONTROLLER_NAME == 'Letter' ? 'active' : ''; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i> <span>短信管理</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="<?php echo U('Letter/index');?>"><i class="fa fa-circle-o"></i> 短信模板</a></li>
                </ul>
            </li>

            <li class="treeview <?php if(CONTROLLER_NAME == Purchase): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i>
                    <span>采购</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="<?php echo U('purchase/index');?>"><i class="fa fa-circle-o"></i> 采购单列表</a></li>
                    <li class="<?php if(ACTION_NAME == setup): ?>active<?php endif; ?>"><a href="<?php echo U('purchase/setup');?>"><i class="fa fa-circle-o"></i> 可采购商品配置</a></li>
                    <li class="<?php if(ACTION_NAME == stores or ACTION_NAME == store_setup): ?>active<?php endif; ?>"><a href="<?php echo U('purchase/stores');?>"><i class="fa fa-circle-o"></i> 店铺可采购商品配置</a></li>
                </ul>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == Vendor): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i> <span>供应商</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="<?php echo U('manage/vendor/index');?>"><i class="fa fa-circle-o"></i>供应商档案</a></li>
                </ul>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == Goods or CONTROLLER_NAME == GoodsCat): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-laptop"></i>
                    <span>商品</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li><a href="<?php echo U('manage/GoodsCat/index');?>"><i class="fa fa-circle-o"></i> 总分类</a></li>
                    <li><a href="<?php echo U('manage/Goods/index');?>" ><i class="fa fa-circle-o"></i> 基础商品库</a></li>
                </ul>
            </li>
            <li class="treeview">
                <a href="javascript:;">
                    <i class="fa fa-edit"></i> <span>订单</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu <?php if(CONTROLLER_NAME == Orders): ?>active<?php endif; ?>">
                    <li><a href="<?php echo U('Orders/orderList');?>"><i class="fa fa-circle-o"></i> 所有订单</a></li>
                </ul>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == Special): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-table"></i> <span>营销</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li><a href="<?php echo U('special/index');?>"><i class="fa fa-circle-o"></i> 专题模板</a></li>
                    <li><a href="<?php echo U('Feedback/index');?>"><i class="fa fa-circle-o"></i> 投诉与建议</a></li>
                </ul>
            </li>
            <li>
                <a href="javascript:;">
                    <i class="fa fa-calendar"></i> <span>统计</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>                
                </a>
                <ul class="treeview-menu">
                    <li><a href=""><i class="fa fa-circle-o"></i> 销售统计</a></li>
                    <li><a href=""><i class="fa fa-circle-o"></i> 会员统计</a></li>
                    <li><a href=""><i class="fa fa-circle-o"></i> 订单统计</a></li>
                </ul>
            </li>
            <li class="<?php echo CONTROLLER_NAME == 'Rbac' ? 'active' : ''; ?>">
                <a href="javascript:;">
                    <i class="fa fa-envelope"></i> <span>权限</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li><a href="/manage/rbac/user"><i class="fa fa-circle-o"></i> 帐户</a></li>
                    <li><a href="/manage/rbac/role"><i class="fa fa-circle-o"></i> 角色</a></li>
                    <li><a href="/manage/rbac/menu"><i class="fa fa-circle-o"></i> 菜单</a></li>
                </ul>
            </li>
            <li class="treeview <?php echo (CONTROLLER_NAME == 'Store' or CONTROLLER_NAME == 'Dly') ? 'active' : ''; ?>">
                <a href="javascript:;">
                    <i class="fa fa-folder"></i> <span>店铺</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li><a href="/manage/store/index"><i class="fa fa-circle-o"></i> 店铺管理</a></li>
                    <li><a href="/manage/store/shelves"><i class="fa fa-circle-o"></i> 可上架商品管理</a></li>
                    <li><a href="/manage/Dly/index"><i class="fa fa-circle-o"></i> 店铺物流公司</a></li>
                </ul>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == Refund or CONTROLLER_NAME == Feedback): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i> <span>售后</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="<?php echo U('Refund/index',array('view'=>1));?>"><i class="fa fa-circle-o"></i> 退款退货</a></li>
                    <li class=""><a href=""><i class="fa fa-circle-o"></i> 投诉</a></li>
                </ul>
            </li>
            <li class="treeview">
                <a href="<?php echo U('User/index');?>">
                    <i class="fa fa-share"></i> <span>会员</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li><a href="<?php echo U('User/index');?>"><i class="fa fa-circle-o"></i> 会员列表</a></li>
                    <li><a href="<?php echo U('User/tempUser');?>"><i class="fa fa-circle-o"></i> 游客列表</a></li>
                </ul>
            </li>
            <li class="treeview <?php if(CONTROLLER_NAME == Bonus): ?>active<?php endif; ?>">
                <a href="javascript:;">
                    <i class="fa fa-th"></i>
                    <span>奖金</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li class="<?php if(ACTION_NAME == index): ?>active<?php endif; ?>"><a href="<?php echo U('Bonus/index');?>"><i class="fa fa-circle-o"></i>奖金流水列表</a></li>
                </ul>
            </li>
            <li class="header">财务</li>
            <li><a href="<?php echo U('Bills/index');?>"><i class="fa fa-circle-o text-red"></i> <span>店铺结算账单</span></a></li>
            <!--<li><a href="#"><i class="fa fa-circle-o text-yellow"></i> <span>备注2</span></a></li>
            <li><a href="#"><i class="fa fa-circle-o text-aqua"></i> <span>备注3</span></a></li>-->


        </ul>
    </section>
    <!-- /.sidebar -->
</aside>

<?php
}else{ ?>

<aside class="main-sidebar">
    <section class="sidebar">
        <!-- 导航页面 -->
        <ul class="sidebar-menu">

            <?php
 foreach ($nav_menu as $k=>$v) { switch ($k) { case 0: $iClass = 'fa-dashboard'; break; case 1: $iClass = 'fa-th'; break; case 2: $iClass = 'fa-laptop'; break; case 3: $iClass = 'fa-edit'; break; case 4: $iClass = 'fa-table'; break; case 5: $iClass = 'fa-folder'; break; default: $iClass = 'fa-dashboard'; } ?>
            <li class="treeview">
                <a href="#">
                    <i class="fa <?php echo $iClass; ?>"></i> <span><?php echo $v['name'];?></span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <?php
 foreach ($menu as $value) { if($v['id'] == $value['nav_menu_id']) { ?>
                    <li><a href="<?php echo $value['value']; ?>"><i class="fa fa-circle-o"></i> <?php echo $value['name']?></a></li>
                    <?php }} ?>
                </ul>
            </li>
            <?php } ?>
        </ul>
         <script type="text/javascript">
			var curHref = window.location.href.toLowerCase();
			$(".sidebar-menu .treeview-menu a").each(function(){
				if(curHref.indexOf($(this).attr("href").toLowerCase()) != -1){
					$(this).parents(".treeview").addClass("active");
					$(this).parent().addClass("active");
				}	
			});
		</script>
    </section>
    <!-- /.sidebar -->
</aside>
<?php } ?>
<style>
    .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
        vertical-align:middle;
    }
</style>
<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            首页
            <small>结算</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="/"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">店铺结算账单</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content">

        <div class="tab-content">
            <div class="tab-pane active" id="tab_0">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title"></h3>
                        <div class="form-inline pull-right">
                            <form action="<?php echo U('Bills/add');?>" method="get">
                                <fieldset>
                                    <div class="btn-group">时间段</div>
                                    <div class="input-group" >
                                        <input class="form-control" type="text" id="start_time" name="start_time" value="<?php echo ($_GET['start_time']); ?>" readonly placeholder="开始日期">
                                    </div>
                                    <div class="btn-group">-</div>
                                    <div class="input-group" >
                                        <input class="form-control" type="text" id="end_time" name="end_time" value="<?php echo ($_GET['end_time']); ?>" readonly placeholder="结束日期">
                                    </div>
                                    <select class="form-control" name="local_id" style="height: 30px; font-size: 12px;">
                                        <option value="" <?php if(local_id == ''): ?>selected="selected"<?php endif; ?>>门店名称</option>
                                        <?php if(is_array($locals)): $i = 0; $__LIST__ = $locals;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["local_id"]); ?>" <?php if($vo['local_id'] == $_GET['local_id']): ?>selected="selected"<?php endif; ?>><?php echo ($vo["local_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                    </select>

                                    <div class="input-group input-group-sm">
                                        <div class="input-group-btn">
                                            <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i>
                                            </button>
                                        </div>
                                    </div>
                                </fieldset>
                            </form>
                        </div>


                    </div>
                    <!-- /.box-header -->
                    <form action="<?php echo U('Bills/save');?>"  method="post" onSubmit="return checkSettleSubmit();">
                    <?php if($order != ''): ?><div class="box-header" style="background-color: #fbed50">
                            <h3 class="box-title">结算明细</h3>
                        </div>
                        <div class="box-body table-responsive no-padding">
                            <table class="table table-hover" id="order-table-list">
                                <tbody>
                                <tr>
                                    <th>ID</th>
                                    <th>订单号</th>
                                    <th>数量</th>
                                    <th>佣金率</th>
                                    <th>抽佣金额</th>
                                    <th>门店优惠</th>
                                    <th>使用奖金</th>
                                    <th>物流费用</th>
                                    <th>订单金额</th>
                                    <th>实支付金额</th>
                                    <th>支付日期</th>
                                    <th>支付方式</th>
                                    <th>操作</th>
                                </tr>
                                <?php if(is_array($order)): $key = 0; $__LIST__ = $order;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($key % 2 );++$key;?><tr class="one-order-area">
                                    <td><?php echo ($key); ?></td>
                                    <td>
                                    	<a href="<?php echo U('orders/orderDetail',array('id'=>$vo['order_id']));?>"><?php echo ($vo["order_id"]); ?></a>
                                        <input type="hidden" name="order[]" value="<?php echo ($vo["order_id"]); ?>">
                                    </td>                                    
                                    <?php if($vo['geshu'] > 1): ?><td>
                                            <table>
                                                <?php if(is_array($vo['list'])): $i = 0; $__LIST__ = $vo['list'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                                    <td><?php echo ($v["name"]); ?></td>
                                                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                            </table>
                                        </td>
                                        <td>
                                            <table>
                                                <?php if(is_array($vo['list'])): $i = 0; $__LIST__ = $vo['list'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                                        <td><?php echo ($v["yc_rate"]); ?>%</td>
                                                    </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                            </table>
                                        </td>
                                        <td>
                                            <table>
                                                <?php if(is_array($vo['list'])): $i = 0; $__LIST__ = $vo['list'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                                        <td><?php echo ($v["yc_fee"]); ?></td>
                                                    </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                            </table>
                                        </td>
                                        <!--<td>-->
                                            <!--<table>-->
                                                <!--<?php if(is_array($vo['list'])): $i = 0; $__LIST__ = $vo['list'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>-->
                                                    <!--<tr>-->
                                                        <!--<td><?php echo ($v["youhui"]); ?></td>-->
                                                    <!--</tr>-->
                                                <!--<?php endforeach; endif; else: echo "" ;endif; ?>-->
                                            <!--</table>-->
                                        <!--</td>-->
                                    <?php else: ?>
                                        <td><?php echo ($vo['list'][0]['name']); ?></td>
                                        <td><?php echo ($vo['list'][0]['yc_rate']); ?>%</td>
                                        <td><?php echo ($vo['list'][0]['yc_fee']); ?></td>
                                        <!--<td><?php echo ($vo['list'][0]['youhui']); ?></td>--><?php endif; ?>
                                    <td>
                                        <?php
 $a = bcadd($vo['cost_freight'], $vo['cost_item'], 2); echo bcsub($a ,$vo['total_amount'], 2); ?>

                                    </td>
                                    <td><?php echo ($vo["bonus_money"]); ?></td>
                                    <td><?php echo ($vo["cost_freight"]); ?></td>
                                    <td><?php echo ($vo["cost_item"]); ?></td>
                                    <td class="grid-order" data-yjfee="<?php echo ((isset($vo["yongjin"]) && ($vo["yongjin"] !== ""))?($vo["yongjin"]):0); ?>" data-cost="<?php echo ($vo['total_amount']); ?>" data-bonus="<?php echo ((isset($vo['bonus_money']) && ($vo['bonus_money'] !== ""))?($vo['bonus_money']):0); ?>"><?php echo ($vo['total_amount']); ?></td>
                                    <td><?php echo (date('Y-m-d H:i:s', $vo["createtime"])); ?></td>
                                    <td><?php echo ((isset($vo["paymethod_name"]) && ($vo["paymethod_name"] !== ""))?($vo["paymethod_name"]):'-'); ?></td>
                                    <td>
                                        <a href="javascript:void(0);" data-id="<?php echo ($key); ?>" class="grid-delete">移除</a>
                                    </td>
                                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                </tbody>
                            </table>
                        </div>
                        <div class="box-header" style="background-color:#ccc">
                            <h3 class="box-title">入账共计</h3>
                        </div>
                        <div class="box-body table-responsive no-padding" style="width:60%;">
                            <table class="table table-hover">
                                <tbody>
                                <tr>
                                    <th>订单数量</th>
                                    <th>订单实支付总金额</th>
                                    <th>抽佣总额</th>
                                    <th>奖金使用总额</th>
                                    <th>银行手续费</th>
                                    <th>其他手续费</th>
                                    <th>应结算总金额</th>
                                </tr>
                                <tr>
                                    <td><span id="zj-order-num"><?php echo ($statistics["order_num"]); ?></span></td>
                                    <td><span id="zj-order-totalcost"><?php echo ($statistics["total_money"]); ?></span></td>
                                    <td><span id="zj-order-totalyj"><?php echo ($statistics["commission"]); ?></span></td>
                                    <td><span id="zj-use-bonus"><?php echo ($statistics["use_bonus"]); ?></span></td>
                                    <td><input id="zj-order-bank" data-key="order-bank" name="bank" type="text" class="form-control" value="0.00"></td>
                                    <td><input id="zj-order-other" data-key="order-other" name="other" type="text" class="form-control" value="0.00"></td>
                                    <td><span id="zj-order-finalfee">正在计算...</span></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div>公式 ： 应结算金额 =  订单支付总额  - 抽佣总额   - 银行手续费 - 其他手续费 - 奖金使用金额</div>
                        <div style="height: 100px;"></div><?php endif; ?>
                    <!-- /.box-body -->
                    <?php if($refund != ''): ?><div class="box-header" style="background-color: #fbed50">
                            <h3 class="box-title">退款明细</h3>
                        </div>
                        <div class="box-body table-responsive no-padding">
                            <table class="table table-hover" id="refund-table-list">
                                <tbody>
                                <tr>
                                    <th>ID</th>
                                    <th>订单号</th>
                                    <th>商品</th>
                                    <th>佣金率</th>
                                    <th>抽佣金额</th>
                                    <th>退款金额</th>
                                    <th>返还奖金</th>
                                    <th>退款完成日期</th>
                                    <th>门店经办</th>
                                    <th>退款经办</th>
                                    <th>操作</th>
                                </tr>
                                <?php if(is_array($refund)): $key = 0; $__LIST__ = $refund;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($key % 2 );++$key;?><tr  class="one-refund-area">
                                        <td><?php echo ($key); ?></td>                                        
                                        <td>
                                        	<?php echo ($vo["order_id"]); ?>
                                            <input type="hidden" name="refund[]" value="<?php echo ($vo["order_id"]); ?>">
                                        </td>
                                        <?php if($vo['geshu'] > 1): ?><td>
                                                <table>
                                                    <?php if(is_array($vo['list'])): $i = 0; $__LIST__ = $vo['list'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                                            <td><?php echo ($v["name"]); ?></td>
                                                        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                                </table>
                                            </td>
                                            <td>
                                                <table>
                                                    <?php if(is_array($vo['list'])): $i = 0; $__LIST__ = $vo['list'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                                            <td><?php echo ($v["yc_rate"]); ?>%</td>
                                                        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                                </table>
                                            </td>
                                            <td>
                                                <table>
                                                    <?php if(is_array($vo['list'])): $i = 0; $__LIST__ = $vo['list'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                                            <td><?php echo ($v["yc_fee"]); ?></td>
                                                        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                                </table>
                                            </td>
                                            <?php else: ?>
                                            <td><?php echo ($vo['list'][0]['name']); ?></td>
                                            <td><?php echo ($vo['list'][0]['yc_rate']); ?>%</td>
                                            <td><?php echo ($vo['list'][0]['yc_fee']); ?></td><?php endif; ?>
                                        <td class="grid-refund" data-yjfee="<?php echo ((isset($vo["yongjin"]) && ($vo["yongjin"] !== ""))?($vo["yongjin"]):0); ?>" data-cost="<?php echo ((isset($vo["price_detail"]) && ($vo["price_detail"] !== ""))?($vo["price_detail"]):0); ?>" data-bonus="<?php echo ((isset($vo['bonus_money']) && ($vo['bonus_money'] !== ""))?($vo['bonus_money']):0); ?>"><?php echo ($vo["price_detail"]); ?></td>
                                        <td><?php echo ($vo["bonus_money"]); ?></td>
                                        <td><?php echo (date('Y-m-d H:i:s', $vo["finance_confirm_t"])); ?></td>
                                        <td><?php echo ($vo["store_name"]); ?></td>
                                        <td><?php echo ($vo["finance_name"]); ?></td>
                                        <td>
                                            <a href="javascript:void(0);" data-id="<?php echo ($key); ?>" class="grid-delete">移除</a>
                                        </td>
                                    </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                                </tbody>
                            </table>
                        </div>
                        <div class="box-header" style="background-color:#ccc">
                            <h3 class="box-title">退款共计</h3>
                        </div>
                        <div class="box-body table-responsive no-padding" style="width:50%;" id="refundZ_div">
                            <table class="table table-hover">
                                <tbody>
                                    <tr>
                                        <th>订单数量</th>
                                        <th>订单退款总金额</th>
                                        <th>抽佣总额</th>
                                        <th>返还奖金总额</th>
                                        <th>其他返款</th>
                                        <th>应退款总金额</th>
                                    </tr>
                                	<tr>
                                        <td><span id="zj-refund-num"><?php echo ($statistics2["refund_num"]); ?></span></td>
                                        <td><span id="zj-refund-totalcost"><?php echo ($statistics2['total_money']); ?></span></td>
                                        <td><span id="zj-refund-totalyj"><?php echo ($statistics2["commission"]); ?></span></td>
                                        <td><span id="zj-refund-bonus"><?php echo ($statistics2["refund_bonus"]); ?></span></td>
                                        <td><input id="zj-refund-other" data-key="refund-other" name="other2" type="text" class="form-control" value="0.00"></td>
                                        <td><span id="zj-refund-finalfee">正在计算...</span></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <div>公式 ： 应退款总金额 = 订单退款总金额 - 退款返还的抽佣金额 - 其他返款 - 奖金返回金额</div>
                        <div style="height: 100px;"></div><?php endif; ?>
                    <?php if($order != '' or $refund != ''): ?><div class="row">
                            <div class="col-md-6">
                                <div class="box-body">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">经办人</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="handle_name" name="handle_name" value="<?php echo session('manageInfo')['login_name'];?>" placeholder="经办人" readonly>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">备注</label>

                                        <div class="col-sm-10">
                                            <textarea class="form-control" rows="3" placeholder="备注" name="handle_tips"></textarea>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div>公式 ： 实际结算金额  =  应结算金额 - 应退款总金额</div>
                                <div><strong>本次结算实际金额:</strong><label class="label label-danger" style="font-size:15px;" id="current-js-fianlfee">正在计算...</label></div>
                            </div>
                        </div>
                        <div>
                            <input type="hidden" name="start_time" value="<?php echo ($_GET['start_time']); ?>">
                            <input type="hidden" name="end_time" value="<?php echo ($_GET['end_time']); ?>">
                            <input type="hidden" name="local_id" value="<?php echo ($_GET['local_id']); ?>">
                            <button class="btn btn-primary btn-lg" type="submit">创建结算对账单</button>
                        </div><?php endif; ?>
                    </form>
                </div>
            </div>

        </div>
    </section>
</div>
<!-- 底部 -->
<!--include file="Public/foot" /-->
<footer class="main-footer">
    <div class="pull-right hidden-xs">
        <b>Version</b> 3.0
    </div>
    <strong>Copyright &copy; 2016-2018 <a href="#">怡臣</a>.</strong> All rights
    reserved.
</footer>
</div>
<!-- Bootstrap 3.3.6 -->
<script src="/Public/admin/adminlte/bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="/Public/admin/adminlte/dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="/Public/admin/adminlte/dist/js/demo.js"></script>
<script data-exec-on-popstate>
    $('.grid-refresh').click(function () {
        window.location.reload();
    });
    $('.gobackpage').click(function () {
        window.history.back();
    })
</script>
</body>
</html>
<link rel="stylesheet" href="/Public/admin/jedate/jedate.css" />
<script src="/Public/admin/jedate/jedate.js"></script>
<script type="text/javascript">
    // 设置时间
    function setJedate(){
        var start = {
            dateCell: '#start_time',
            format: 'YYYY-MM-DD',
            minDate: '1970-01-01 00:00:00',
            festival: false,
            maxDate: '2099-12-31 23:59:59',
            isinitVal:true,
            isTime: true,
            choosefun: function(datas) {
                end.minDate = datas; 
            }
        };
        var end = {
            dateCell: '#end_time',
            format: 'YYYY-MM-DD',
            minDate: '1970-01-01 00:00:00',
            festival: false,
            maxDate: '2099-12-31 23:59:59',
            isinitVal:true,
            isTime: true,
            choosefun: function(datas) {
                start.maxDate = datas;
            }
        };
        jeDate(start);
        jeDate(end);
    }
    setJedate();
</script>
<script type="text/javascript" src="/Public/admin/js/com.bill.js.js"></script>